package com.team2.outpatient_sys.service.impl;

import com.team2.outpatient_sys.dao.DoctorDao;
import com.team2.outpatient_sys.pojo.Doctor;
import com.team2.outpatient_sys.service.PersonalService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

@Service
@Transactional
public class PersonalServiceImpl implements PersonalService {
    @Autowired
    private DoctorDao doctorDao;

    @Override
    public Doctor findByName(String name) {
        return doctorDao.queryByUsername(name);
    }

    @Override
    public Doctor findByIdAndPass(Integer id, String password) {
        return doctorDao.findByIdAndPass(id,password);
    }

    @Override
    public Integer updateNewPass(String password, Integer id) {
        return doctorDao.updateNewPass(password,id);
    }

    @Override
    public Doctor findByUsername(String username) {
        return doctorDao.findByUsername(username);
    }

    @Override
    public Integer updatePersonal(Doctor doctor) {
        return doctorDao.updateWholeById(doctor);
    }
}
